<%@page import="model.UserInfoBase"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<!-- CSS -->
<style type="text/css"> 
.table_and_line 
{ 
width: 100%; 
padding: 0; 
margin: 0; 
min-height:700px;
max-height:700px;
float:left;
background:#FFFFFF;
} 

.line
{
background: #0f5fa7;
width: 15%; 
padding: 0; 
margin: 0; 
min-height:700px;
float:left;
border:1;
}
.line .head_div
{
	width: 100%; 
	float: left;
	min-height:40px;
	background: #0f5fa7;
}
.line .head_div_half
{
	width: 100%; 
	float: left;
	min-height:15px;
	background: #0f5fa7;
}
.line .head_left
{
	width: 15%; 
	float: left;
	min-height:100px;
}
.line .head_left_small
{
	width: 15%; 
	float: left;
	min-height:30px;
}
.line .head_name
{
	font: bold 15px "Trebuchet MS", Arial, Helvetica, sans-serif; 
	color: #FFFFFF; 
	float: center;
}
.line .head
{
	border:0px;
	width: 70%; 
	height:70%;
	float:center;
}
.line .head .img
{
	background:url(assets/img/head.png);
	width:100px;
	height:100px;
}

.line .item
{
	width: 100%; 
	background: #0f5fa7;
}
.line .item .button_font{
	border:0px;
	font: bold 17px "Trebuchet MS", Helvetica, sans-serif; 
	color: #FFFFFF; 
	float: left;
	background: #0f5fa7;
}
.line .search_box
{
	width: 60%; 
}
.line .search_button
{ 
	background:url(assets/img/search.png);
	width:25px;
	height:25px;
	border:0; 
}



.table_sround
{ 
width: 85%; 
padding: 0; 
margin: 0; 
float:right;
min-height:700px;
max-height:700px;
overflow:scroll;
overflow:auto;
} 
.table 
{ 
width: 100%; 
padding: 0; 
margin: 0; 
float:right;
overflow:scroll;
overflow:auto;
} 
th { 
font: bold 13px "Trebuchet MS", Arial, Helvetica, sans-serif; 
color: #4f6b72; 
border-right: 1px solid #C1DAD7; 
border-bottom: 1px solid #C1DAD7; 
border-top: 1px solid #C1DAD7; 
letter-spacing: 2px; 
text-transform: uppercase; 
text-align: left; 
padding: 6px 6px 6px 12px; 
background: #CAE8EA no-repeat; 
} 
td { 
border-right: 1px solid #C1DAD7; 
border-bottom: 1px solid #C1DAD7; 
background: #fff; 
font-size:14px; 
padding: 6px 6px 6px 12px; 
color: #4f6b72; 
} 
td.alt { 
background: #F5FAFA; 
color: #797268; 
} 
th.spec,td.spec { 
border-left: 1px solid #C1DAD7; 
} 
/*---------for IE 5.x bug*/ 
html>body td{ font-size:14px;} 
tr.select th,tr.select td 
{ 
background-color:#CAE8EA; 
color: #797268; 
} 
</style> 


<body>

<!-- the body is a table -->
<%
	String str = new String();
	String username = (String)request.getSession().getAttribute("username");
	str += "username :" + username + "<br>" ;
	UserInfoBase userInfo = (UserInfoBase) request.getSession().getAttribute(username);
	str += "userInfo:" +userInfo;
	String[] titles = userInfo.pageManeger.getTableTitle();
	String imei = request.getParameter("imei");
	String lineActionStr = "";
%>

<div class = "table_and_line" >

	<div class="line">
		<div class = "head_div"></div>
		<div>
			<div class="head_left"></div>
			<div class = "head">
				<img class = "img" ></img>
			</div>
			<div class="head_left_small"></div>
			<div class = "head_name"><p>昵称：<%=username %></p></div>
		</div>
		
		<div class = "head_div_half"></div>
		<div>
			<div class="head_left_small"></div>
			<form>
				<input class="search_box" type="text" placeholder="请输入imei查询"></input>
				<button class="search_button" type="submit"></button>
			</form>
		</div>
		
		<!-- 点击以后刷新页面 -->
		<% lineActionStr="Update?"+"username="+username+"&"+"imei="+imei; %>
		<div class = "head_div"></div>
		<div class = "item">
			<div class="head_left_small"></div>
			<form action=<%=lineActionStr %> method="post">
				<button type="submit" class = "button_font">刷新</button>
			</form>
		</div>

<!-- 只有超级管理员才能看到的信息 -->
	
<% if(username.equals("admin")){ %>
		<% lineActionStr="UsersShow?"+"username="+username; %>	
		<div class = "head_div_half"></div>
		<div class = "item">
		<div class="head_left_small"></div>
			<form action=<%=lineActionStr %> method="post" >
				<button type="submit" class = "button_font">查看用户资料</button>
			</form>
		</div>
		
		<% lineActionStr="userinput.jsp?method=create"; %>	
		<div class = "head_div_half"></div>
		<div class = "item">
			<div class="head_left_small"></div>
			<form action=<%=lineActionStr %> method="post"  >
				<button type="submit" class = "button_font">添加新用户</button>
			</form>
		</div>

<%} %>
		
		
		<% lineActionStr="order.jsp?"+"username="+username+"&"+"imei="+imei; %>
		<!-- 点击跳转至发送指令页面 -->
		<div class = "head_div_half"></div>
		<div class = "item">
			<div class="head_left_small"></div>
			<form action=<%=lineActionStr %> method="post" target="_blank">
				<button type="submit" class = "button_font">发送操作指令</button>
			</form>
		</div>
		
		<!-- 点击以后查看该用户没有发送的命令 -->
		<% lineActionStr="OrderShow?"+"username="+username; %>
		<div class = "head_div_half"></div>
		<div class = "item">
			<div class="head_left_small"></div>
			<form action=<%=lineActionStr %> method="post" >
				<button type="submit" class = "button_font">未完成指令</button>
			</form>
		</div>
		
		<!-- 点击然后进行注销操作 -->
		<% lineActionStr="UnLogin?"+"username="+username; %>
		<div class = "head_div_half"></div>
		<div class = "item">
			<div class="head_left_small"></div>
			<form action=<%=lineActionStr %> method="post">
				<button type="submit" class = "button_font">注销</button>
			</form>
		</div>
		
	</div>
		
	<div class="table_sround">
			<table  class="table" cellspacing="0" summary="The technical specifications of the Apple PowerMac G5 series">		
			<tr>
			<%
				String titleTop = new String();
				for(int i=0;i<titles.length;i++){
					titleTop += "<th>" + titles[i] + "</th>"; 
				}
			%>
			<%=titleTop %>
			</tr>
			
			<%
				String titleBody = new String();
				int totalLines = userInfo.pageManeger.getPageLines(userInfo.page);
				for(int i=0;i<totalLines;i++){
					titleBody+="<tr>";
					String[] linecells = userInfo.pageManeger.getLines(userInfo.page, i);
					for(int j=0;j<linecells.length;j++){
						titleBody+="<td>"+linecells[j]+"</td>";
					}
					titleBody+="</tr>";
				}
				
			%>
			<%=titleBody %>
			</table>
	</div>
</div>
</body>
</html>